﻿package znet

import (
	"io"
	"net"
	"zxGoServer/zinterface"
)

type NetTcpConn struct {
	zinterface.INetConn
	tcpConn *net.TCPConn
}

func NewNetTcpConn(tcpConn *net.TCPConn) *NetTcpConn {
	return &NetTcpConn{
		tcpConn: tcpConn,
	}
}

func (nc *NetTcpConn) Close() error {
	return nc.tcpConn.Close()
}

func (nc *NetTcpConn) RemoteAddr() net.Addr {
	return nc.tcpConn.RemoteAddr()
}

func (nc *NetTcpConn) Write(msg []byte) (int, error) {
	return nc.tcpConn.Write(msg)
}

func (nc *NetTcpConn) ReadFull(buf []byte) (int, error) {
	return io.ReadFull(nc.tcpConn, buf)
}
